<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCuresTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('cures', function (Blueprint $table) {
			$table->increments('id');
			$table->unsignedMediumInteger('shop_id')->default(0)->comment('门店ID');
			$table->unsignedMediumInteger('device_id')->default(0)->comment('设备ID');
			$table->unsignedMediumInteger('user_id')->default(0)->comment('治疗人ID');
			$table->unsignedMediumInteger('member_id')->default(0)->comment('成员(被治疗人)ID');
			$table->boolean('symptom')->default(0)->comment('梳理病症 1:疼痛 2:炎症 3:肿块 4:高血压 5:糖尿病 6:高血脂');
			$table->boolean('comb_mpa')->default(0)->comment('梳理强度 1:轻 2:中 3:强');
			$table->string('comb_head')->default('')->comment('梳理头');
			$table->boolean('magnetic')->default(0)->comment('磁场强度 1:低 2:中 3:强');
			$table->unsignedTinyInteger('acupoint')->default(0)->comment('穴位 1-60个');
			$table->unsignedTinyInteger('hr')->default(0)->comment('心率 bpm');
			$table->unsignedTinyInteger('bo')->default(0)->comment('血氧 %');
			$table->unsignedTinyInteger('sbp')->default(0)->comment('收缩压 mmHg');
			$table->unsignedTinyInteger('dbp')->default(0)->comment('舒张压 mmHg');
			$table->timestamp('cured_at')->nullable()->comment('治疗时间');
			$table->unsignedSmallInteger('duration')->default(0)->comment('时长 s');
			$table->timestamps();
			$table->index(['device_id', 'user_id', 'member_id'], 'DidUidMid');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::dropIfExists('cures');
	}
}
